package com.ruoyi.query.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.DynamicAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;

/**
 * <p>
 * 列表查询列
 * </p>
 *
 * @author XiaShiLong
 * @since 2021-03-25
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("dl_table_query_column")
@ApiModel(value = "列表查询列", description = "列表查询列")
public class TableQueryColumn implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @DynamicAnnotation("主键")
    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 菜单id
     */
    @DynamicAnnotation("菜单id")
    @ApiModelProperty(value = "菜单id")
    private Long menuId;

    /**
     * 表名
     */
    @DynamicAnnotation("表名")
    @ApiModelProperty(value = "表名")
    private String tableName;

    /**
     * 属性名
     */
    @DynamicAnnotation("属性名")
    @ApiModelProperty(value = "属性名")
    private String attributeName;

    /**
     * 列名
     */
    @DynamicAnnotation("列名")
    @ApiModelProperty(value = "列名")
    private String columnName;

    /**
     * 中文字段名
     */
    @DynamicAnnotation("中文字段名")
    @ApiModelProperty(value = "中文字段名")
    private String nameCh;

    /**
     * 字段类型
     */
    @DynamicAnnotation("字段类型")
    @ApiModelProperty(value = "字段类型")
    private String type;

    /**
     * hovId
     */
    @DynamicAnnotation("hovId")
    @ApiModelProperty(value = "hovId")
    private Long hovId;

    /**
     * 使用中
     */
    @TableField(exist = false)
    private boolean employ;

    /**
     * 是否radio(勾选框)
     */
    @TableField(exist = false)
    private boolean radio;

    public void use(Long id) {
        this.setEmploy(true);
        this.id = id;
    }
}
